<template>
    <div>
        <h3>后台管理系统</h3>
        <el-container>
            <!-- 侧边栏 -->
            <el-aside width="300px">
                <el-row>
                      <el-col :span="24">
                        <el-menu
                        default-active="2"
                        class="el-menu-vertical-demo"
                        @open="handleOpen"
                        @close="handleClose"
                        @select="handleSelect"
                        background-color="#545c64"
                        text-color="#fff"
                        active-text-color="#ffd04b">
                        <el-submenu index="1">
                            <template slot="title">
                            <i class="el-icon-user"></i>
                            <span>用户</span>
                            </template>
                            <el-menu-item-group>
                            <el-menu-item index="4-1" to="#" @click="flag=6">注册</el-menu-item>
                            <el-menu-item index="4-2" to="#" @click="flag=7">登录</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        <el-submenu index="1">
                            <template slot="title">
                            <i class="el-icon-setting"></i>
                            <span>部门管理</span>
                            </template>
                            <el-menu-item-group>
                            <el-menu-item index="1-1" to="#" @click="flag=0">预览部门</el-menu-item>
                            <el-menu-item index="1-2" to="#" @click="flag=1">管理部门</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        <el-submenu index="2">
                            <template slot="title">
                            <i class="el-icon-menu"></i>
                            <span slot="title">职责管理</span>
                            </template>
                            <el-menu-item-group>
                            <el-menu-item index="2-1" to="#" @click="flag=2">预览职责</el-menu-item>
                            <el-menu-item index="2-2" to="#" @click="flag=3">职责管理</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        <el-submenu index="3">
                            <template slot="title">
                            <i class="el-icon-user-solid"></i>
                            <span slot="title">员工管理</span>
                            </template>
                            <el-menu-item-group>
                            <el-menu-item index="3-1" to="#" @click="flag=4">预览员工</el-menu-item>
                            <el-menu-item index="3-2" to="#" @click="flag=5">员工管理</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        </el-menu>
                    </el-col>
                </el-row>
            </el-aside>
            <!-- 视图栏 -->
            <el-main>
                <div v-if="flag==0"><deparement-list/></div>
                <div v-if="flag==1"><dep-detail/></div>
                <div v-if="flag==2"><duty-list/></div>
                <div v-if="flag==3"><duty-detail/></div>
                <div v-if="flag==4"><staff-list/></div>
                <div v-if="flag==5"><staff-detail/></div>
                <div v-if="flag==6"><register/></div>
                <div v-if="flag==7"><login/></div>
                

            </el-main>
        </el-container>
    </div>
</template>

<script>
import DeparementList from "../../components/work/DepartmentList.vue"
import DepDetail from "../../components/work/DepDetail.vue"
import DutyDetail from "../../components/work/DutyDetail.vue"
import DutyList from "../../components/work/DutyList.vue"
import StaffList from "../../components/work/StaffList.vue"
import StaffDetail from "../../components/work/StaffDetail.vue"
import Register from "../../components/user/Register.vue"
import Login from "../../components/user/Login.vue"

export default {
    components:{
        DeparementList,
        DepDetail,
        DutyList,
        DutyDetail,
        StaffList,
        StaffDetail,  
        Register,  
        Login,       
    },
    data(){
        return{
            flag:4,


        }
    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      handleSelect(value){
          console.log("点击了", value)
      },
      
    }

}
</script>

<style>
    .el-aside {
        background-color: #D3DCE6;
        color: #333;
        /* text-align: center; */
        line-height: 200px;
    }
    
    .el-main {
        background-color: #E9EEF3;
        color: #333;
        /* text-align: center; */
        line-height: 160px;
    }

</style>